package com.nbjtjc.safe.api.safe;

import com.nbjtjc.safe.bean.Result;
import com.nbjtjc.safe.model.safe.SafeDangerChemical;
import com.nbjtjc.safe.service.safe.SafeDangerChemicalServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/safe/chemical")
@CrossOrigin("*")
public class SafeDangerChemicalController {

    @Autowired
    private SafeDangerChemicalServiceImpl chemicalService;

    @PostMapping("/find")
    public Result find(SafeDangerChemical chemical){
        return chemicalService.find(chemical);
    }

    @PostMapping("/add")
    public Result add(SafeDangerChemical chemical){
        return chemicalService.add(chemical);
    }

    @PostMapping("/delete")
    public Result delete(SafeDangerChemical chemical){
        return chemicalService.delete(chemical);
    }

    @PostMapping("/update")
    public Result update(SafeDangerChemical chemical){
        return chemicalService.update(chemical);
    }
}
